import _ from 'lodash';
import fs from 'fs-extra';
import path from 'path';
import ejs from 'ejs';
import { readFileSync } from 'fs';
import { join } from 'path';
import { UserProxy, TopicProxy } from '../proxy';
import { apiPrefix } from '../../config';

export default function (appId, zone, res) {
  if (!zone) throw new Error('zone is null');

  const str = readFileSync(join(__dirname, '/views/components/createPanel.ejs'), 'utf8');
  const html = ejs.compile(str)({ createHref: `${apiPrefix.page}/zone/${zone.key}/${zone.template}/topic/create?appId=${appId}&zoneId=${zone._id}`, createText: zone.createText });
  return html;
}
